using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Scene;
using System;
namespace MicroMsg.Manager
{
	public class GetPackageListMgr
	{
		private const string TAG = "GetPackMgr";
		public const double TIME_INTER_GETPACKAGE = 86400000.0;
		public const double TIME_INTER_GETEGG = 86400000.0;
		private static EventWatcher mWatcher;
		public static void checkInit()
		{
			if (GetPackageListMgr.mWatcher == null)
			{
				GetPackageListMgr.mWatcher = new EventWatcher(null, null, new EventHandlerDelegate(GetPackageListMgr.HandlerDoScene));
				EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_SYNC, GetPackageListMgr.mWatcher);
			}
		}
		private static void HandlerDoScene(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			NetSceneSyncResult netSceneSyncResult = evtArgs.mObject as NetSceneSyncResult;
			if (netSceneSyncResult == null)
			{
				Log.smethod_1("GetPackMgr", "NetSceneSyncResult == null");
				return;
			}
			if (netSceneSyncResult.syncStatus == SyncStatus.syncEnd)
			{
				Log.smethod_5("GetPackMgr", "onHander sync event result.syncStatus = " + netSceneSyncResult.syncStatus);
				double num = Util.getNowMilliseconds() - ConfigMgr.getDouble("dbLastGetEmojiArtTimeStamp", 0.0);
				if (num > 86400000.0)
				{
					Log.smethod_5("GetPackMgr", "It is time to get emojiArt");
					new NetSceneGetPackageList().doScene(2);
				}
				double num2 = Util.getNowMilliseconds() - ConfigMgr.getDouble("dbLastGetEggTimeStamp", 0.0);
				if (num2 > 86400000.0)
				{
					Log.smethod_5("GetPackMgr", "It is time to get egg");
					new NetSceneGetPackageList().doScene(6);
				}
			}
		}
		public static bool getPackageList(int type)
		{
			GetPackageListMgr.checkInit();
			return new NetSceneGetPackageList().doScene(type);
		}
	}
}
